﻿using System;
using System.Drawing;
using System.Drawing.Imaging;

namespace ru.yourpictures.Core.Imaging.Filters
{
    [FilterImplementation(GdiPlusImplemented=false, LowLevelImplemented=true)]
    public class RotateFlip : FilterBase
    {
        private RotateFlipType _rotate = RotateFlipType.RotateNoneFlipNone;

        public RotateFlipType RotateFlipType
        {
          get { return _rotate; }
          set { _rotate = value; }
        }

        #region Ctor
        public RotateFlip(RotateFlipType rotateFlipType)
        {
            _rotate = rotateFlipType;
        }
        public RotateFlip()
        {
        }
        #endregion

        #region FilterImplementation
        protected override void FilterImplementation()
        {
            throw new NotImplementedException("Low level mode is not implemented");
        }
        #endregion

        public override void  Apply(Bitmap b)
        {
            b.RotateFlip(_rotate);
        }

        public override Bitmap Convert(Bitmap b)
        {
            Bitmap bmp = b.Clone(new Rectangle(0, 0, _width, _height), b.PixelFormat);
            Apply(bmp);
            return bmp;
        }
    }
}
